Empty case
clauses that fall through to the default are useless. Whether or not such a case
is present, the
default
clause will be invoked. Such case
s simply clutter the code, and should be removed.
Noncompliant code example
switch(ch)
{
case 'a' :
handleA();
break;
case 'b' :
handleB();
break;
case 'c' : // Noncompliant
default:
handleTheRest();
break;
}
Compliant solution
switch(ch)
{
case 'a' :
handleA();
break;
case 'b' :
handleB();
break;
default:
handleTheRest();
break;
}